//
//  GYHomeTopViewModel.m
//  GYDemo
//
//  Created by Mrzhang on 2018/3/30.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "GYHomeTopViewModel.h"
#import "Head.h"

@implementation GYAdModel

@end
@implementation GYMarketPriceModel

@end

@implementation GYHomeTopViewModel

-(NSMutableArray *)bannerArr
{
    if (!_bannerArr) {
        _bannerArr=[[NSMutableArray alloc] init];
    }
    return _bannerArr;
}

-(NSMutableArray *)marketPriceArr
{
    if (!_marketPriceArr) {
        _marketPriceArr=[[NSMutableArray alloc] init];
    }
    return _marketPriceArr;
}

-(void)requestAd:(NSMutableDictionary *)para
{

    @WeakSelf;
    NSString *interface = @"UVTGetGoodList";

    [[InterfaceManager shareInterface]requetInterface:interface withParameter:@{@"type":@"90"}.mutableCopy handler:^(NSDictionary *info, InterfaceStatusModel *infoModel) {
        NSArray *datalist = (NSArray*)info;
        
        if ([datalist isKindOfClass:[NSArray class]]) {
            NSMutableArray *arr=[[NSMutableArray alloc] init];;
            for (NSDictionary *dic in datalist) {
                GYHomeBuyProductInfoModel *model = [GYHomeBuyProductInfoModel yy_modelWithJSON:dic];
                [arr addObject:model];
            }
            [selfp setBannerArr:arr];
            
        }
    }];
}
-(void)requestMarket:(NSMutableDictionary *)para
{
    @WeakSelf;
    NSString *interface = @"marketCenterPrice";
    [[InterfaceManager shareInterface]requetInterface:interface withParameter:para handler:^(NSDictionary *info, InterfaceStatusModel *infoModel) {
        NSArray *datalist = infoModel.data;
        
        if ([datalist isKindOfClass:[NSArray class]]) {
            NSMutableArray *arr=[[NSMutableArray alloc] init];;
            for (NSDictionary *dic in datalist) {
                GYMarketPriceModel *model = [GYMarketPriceModel yy_modelWithJSON:dic];
                [arr addObject:model];
            }
            [selfp setMarketPriceArr:arr];
        }
    }];
}
@end
